package com.easyn.P2PCam264;

import android.util.Log;

import com.tutk.IOTC.Packet;

public class HICHIPIOCTRDEFs {

	public static final int IOTYPE_HICHIP_CRUISE_START = 0x0600;
	public static final int IOTYPE_HICHIP_CRUISE_STOP = 0x0601;
	public static final byte AVIOCTRL_CRUISEMODE_VERTICAL = 0x00;
	public static final byte AVIOCTRL_CRUISEMODE_HORIZONTAL = 0x01;

	public static final int IOTYPE_HICHIP_GETBRIGHT_REQ = 0x602;
	public static final int IOTYPE_HICHIP_GETBRIGHT_RESP = 0x603;
	public static final int IOTYPE_HICHIP_SETBRIGHT_REQ = 0x604;
	public static final int IOTYPE_HICHIP_SETBRIGHT_RESP = 0x605;
	public static final byte AVIOCTRL_BRIGHT_MAX = 0x01;
	public static final byte AVIOCTRL_BRIGHT_HIGH = 0x02;
	public static final byte AVIOCTRL_BRIGHT_MIDDLE = 0x03;
	public static final byte AVIOCTRL_BRIGHT_LOW = 0x04;
	public static final byte AVIOCTRL_BRIGHT_MIN = 0x05;

	public static final int IOTYPE_HICHIP_GETCONTRAST_REQ = 0x606;
	public static final int IOTYPE_HICHIP_GETCONTRAST_RESP = 0x607;
	public static final int IOTYPE_HICHIP_SETCONTRAST_REQ = 0x608;
	public static final int IOTYPE_HICHIP_SETCONTRAST_RESP = 0x609;
	public static final byte AVIOCTRL_CONTRAST_MAX = 0x01;
	public static final byte AVIOCTRL_CONTRAST_HIGH = 0x02;
	public static final byte AVIOCTRL_CONTRAST_MIDDLE = 0x03;
	public static final byte AVIOCTRL_CONTRAST_LOW = 0x04;
	public static final byte AVIOCTRL_CONTRASTT_MIN = 0x05;

	public static final int IOTYPE_USER_IPCAM_SETPRESET_REQ = 0x440;
	public static final int IOTYPE_USER_IPCAM_SETPRESET_RESP = 0x441;
	public static final int IOTYPE_USER_IPCAM_GETPRESET_REQ = 0x442;
	public static final int IOTYPE_USER_IPCAM_GETPRESET_RESP = 0x443;

	public static final int IOTYPE_USER_IPCAM_GETGUARD_REQ = 0x420;
	public static final int IOTYPE_USER_IPCAM_GETGUARD_RESP = 0x421;
	public static final int IOTYPE_USER_IPCAM_SETGUARD_REQ = 0x422;
	public static final int IOTYPE_USER_IPCAM_SETGUARD_RESP = 0x423;

	// FTP����/////////////////////////////////////////////////////////
	public static final int IOTYPE_USER_IPCAM_SET_FTP_REQ = 0x055A;
	public static final int IOTYPE_USER_IPCAM_SET_FTP_RESP = 0x055B;
	public static final int IOTYPE_USER_IPCAM_GET_FTP_REQ = 0x055C;
	public static final int IOTYPE_USER_IPCAM_GET_FTP_RESP = 0x055D;

	// mail����////////////////////////////////////////////////////////
	public static final int IOTYPE_USEREX_IPCAM_GET_SMTP_REQ = 0x4005;
	public static final int IOTYPE_USEREX_IPCAM_GET_SMTP_RESP = 0x4006;
	public static final int IOTYPE_USEREX_IPCAM_SET_SMTP_REQ = 0x4007;
	public static final int IOTYPE_USEREX_IPCAM_SET_SMTP_RESP = 0x4008;

	public static class SMsgAVIoctrlCruiseStart {
		int channel; // Camera Index
		byte mode; // refer to ENUM_CRUISE_MODE
		byte[] reserved = new byte[3];

		public static byte[] parseContent(int channel, byte mode) {
			byte[] result = new byte[8];
			byte[] ch = Packet.intToByteArray_Little(channel);
			System.arraycopy(ch, 0, result, 0, 4);
			result[4] = mode;
			Log.i("bbbbbbbb", result.toString());
			return result;

		}

	}

	public static class SMsgAVIoctrlCruiseStop {
		int channel;
		byte[] reserved = new byte[4];

		public static byte[] parseContent(int channel) {

			byte[] result = new byte[8];
			byte[] ch = Packet.intToByteArray_Little(channel);
			System.arraycopy(ch, 0, result, 0, 4);
			return result;
		}
	}

	// ��ȡ�Աȶ�
	public static class SMsgAVIoctrlGetContrastReq {
		int channel; // Camera Index
		byte[] reserved = new byte[4];

		public static byte[] parseContent(int channel) {

			byte[] result = new byte[8];
			byte[] ch = Packet.intToByteArray_Little(channel);
			System.arraycopy(ch, 0, result, 0, 4);

			return result;
		}

	}

	// ��ȡ�ԱȶȽ��
	public static class SMgAVIoctrlGetContrastResp {
		int channel;
		byte contrast; // refer to ENUM_CONTRAST_LEVEL
		byte[] reserved = new byte[3];

	}

	// ���öԱȶ�
	public static class SMsgAVIoctrSeltContrastRep {

		int channel;
		byte contrast; // refer to ENUM_CONTRAST_LEVEL
		byte[] reserved = new byte[3];

		public static byte[] parseContent(int channel, byte contrast) {

			byte[] result = new byte[8];
			byte[] ch = Packet.intToByteArray_Little(channel);
			System.arraycopy(ch, 0, result, 0, 4);
			result[4] = contrast;
			return result;
		}
	}

	// ���öԱȶȽ��
	public static class SMsgAVIoctrSeltContrastResp {
		int result; // 0: success; otherwise: failed.
		byte[] reserved = new byte[4];
	}

	// ��ȡ����
	public static class SMsgAVIoctrlGetBrightReq {

		int channel; // Camera Index
		byte[] reserved = new byte[4];

		public static byte[] parseContent(int channel) {

			byte[] result = new byte[8];
			byte[] ch = Packet.intToByteArray_Little(channel);
			System.arraycopy(ch, 0, result, 0, 4);

			return result;
		}
	}

	// ��ȡ���Ƚ��
	public static class SMgAVIoctrlGetBrightResp {
		int channel; // Camera Index
		byte bright; // refer to ENUM_BRIGHT_LEVEL
		byte[] reserved = new byte[3];

	}

	// ������������
	public static class SMsgAVIoctrlSetBrightReq {
		int channel; // Camera Index
		byte bright; // refer to ENUM_BRIGHT_LEVEL
		byte[] reserved = new byte[3];

		public static byte[] parseContent(int channel, byte bright) {

			byte[] result = new byte[8];
			byte[] ch = Packet.intToByteArray_Little(channel);
			System.arraycopy(ch, 0, result, 0, 4);
			result[4] = bright;
			return result;
		}

	}

	// �������Ƚ��
	public static class SMsgAVIoctrSeltBrightResp {
		int result; // 0: success; otherwise: failed.
		byte[] reserved = new byte[4];
	}

	// ����Ԥ�õ�����
	public static class SMsgAVIoctrlSetPresetReq {
		int channel;
		int nPresetIdx;

		public static byte[] parseContent(int channel, int nPresetIdx) {
			byte[] result = new byte[8];
			byte[] ch = Packet.intToByteArray_Little(channel);
			byte[] sen = Packet.intToByteArray_Little(nPresetIdx);
			System.arraycopy(ch, 0, result, 0, 4);
			System.arraycopy(sen, 0, result, 4, 4);
			return result;
		}

	}

	public static class SMsgAVIoctrlSetImageParamReq {
		int channel;
		int brightness; /* value: 1-100 */
		int saturation; /* value: 1-100 */
		int contrast; /* value: 1-100 */
		int todefault; /* value : if set !0 ,image to default value */
		byte[] reserved = new byte[16];

		public static byte[] parseContent(int channel, int brightness,
				int saturation, int contrast, int todefault) {
			byte[] result = new byte[36];
			byte[] ch = Packet.intToByteArray_Little(channel);
			byte[] br = Packet.intToByteArray_Little(brightness);
			byte[] sa = Packet.intToByteArray_Little(saturation);
			byte[] con = Packet.intToByteArray_Little(contrast);
			byte[] to = Packet.intToByteArray_Little(todefault);
			System.arraycopy(ch, 0, result, 0, 4);
			System.arraycopy(br, 0, result, 4, 4);
			System.arraycopy(sa, 0, result, 8, 4);
			System.arraycopy(con, 0, result, 12, 4);
			System.arraycopy(to, 0, result, 16, 4);
			return result;
		}

	}

	// ��ȡԤ�õ�����
	public static class SMsgAVIoctrlGetPresetReq {
		int channel;
		int nPresetIdx;

		public static byte[] parseContent(int channel, int nPresetIdx) {
			byte[] result = new byte[8];
			byte[] ch = Packet.intToByteArray_Little(channel);
			byte[] sen = Packet.intToByteArray_Little(nPresetIdx);
			System.arraycopy(ch, 0, result, 0, 4);
			System.arraycopy(sen, 0, result, 4, 4);
			return result;
		}
	}

	// ��ȡԤ�õ�ظ�
	public static class SMsgAVIoctrlGetPresetResp {
		int channel;
		int nPresetIdx;
	}

	// ����Ԥ�õ�ظ�
	public static class SMsgAVIoctrlSetPresetResp {
		int result; // �؂�ֵ 0: success; otherwise: failed
		byte[] reserved = new byte[4];
	}

	// ����״̬

	public static class SMsgAVIoctrlGetGuardReq {
		int channel; // AvServer Index
		byte[] reserved = new byte[4];

		public static byte[] parseContent(int channel) {
			byte[] result = new byte[8];
			byte[] ch = Packet.intToByteArray_Little(channel);
			System.arraycopy(ch, 0, result, 0, 4);

			return result;
		}
	}

	// ����״̬�ظ�
	public static class SMsgAVIoctrlGetGuardResp {
		int channel; // AvServer Index
		byte alarm_motion_armed; // �ƶ���⿪�� ON=1, OFF=0
		byte alarm_motion_sensitivity; // 1(MIN) ~ 100(MAX)
										// �ο�TUTK��SMsgAVIoctrlSetMotionDetectReq��sensitivity
										// ֵ��������
		byte alarm_preset; /* ��������Ԥ��λ 0���رգ�1��4��ѡ������Ԥֵλ */
		byte alarm_mail; /* ����ʱ�ʼ�֪ͨ 0����ֹ��1������ */
		int alarm_upload_interval; /* ����ʱ�ϴ�ͼƬ�ļ�����룩��0����ֹ */
	}

	// ���ð�����
	public static class SMsgAVIoctrlSetGuardReq {
		int channel; // AvServer Index
		byte alarm_motion_armed; // �ƶ���⿪�� ON=1, OFF=0
		byte alarm_motion_sensitivity; // 1(MIN) ~ 100(MAX)
										// �ο�TUTK��SMsgAVIoctrlSetMotionDetectReq��sensitivity
										// ֵ��������
		byte alarm_preset; /* ��������Ԥ��λ 0���رգ�1��4��ѡ������Ԥֵλ */
		byte alarm_mail; /* ����ʱ�ʼ�֪ͨ 0����ֹ��1������ */
		int alarm_upload_interval; /* ����ʱ�ϴ�ͼƬ�ļ�����룩��0����ֹ */

		public static byte[] parseContent(int channel, byte alarm_motion_armed,
				byte alarm_motion_sensitivity, byte alarm_preset,
				byte alarm_mail, int alarm_upload_interval) {
			byte[] result = new byte[12];
			byte[] ch = Packet.intToByteArray_Little(channel);
			byte[] interval = Packet
					.intToByteArray_Little(alarm_upload_interval);
			System.arraycopy(ch, 0, result, 0, 4);
			result[4] = alarm_motion_armed;
			result[5] = alarm_motion_sensitivity;
			result[6] = alarm_preset;
			result[7] = alarm_mail;
			System.arraycopy(interval, 0, result, 8, 4);
			return result;
		}
	}

	public static class SMsgAVIoctrlSetGuardResp {
		int result;
		byte[] reserved = new byte[4];
	}

	// /////////////////////////////////////////FTP����/////////////////////////////////////
	public static class SMsgAVIoctrlSetFtpReq {
		int channel; // Camera Index
		byte[] ftpServer = new byte[68]; // 10.1.1.1
		int ftpPort; // 21
		byte[] userName = new byte[20];
		byte[] password = new byte[20];
		byte[] path = new byte[68];
		int passiveMode;// 0 - off, 1 - on

		// total 188 bytes
		public static byte[] parseContent(int nchannel, String ftpServer,
				int nftpPort, String userName, String password, String path,
				int passiveMode) {
			byte[] result = new byte[188];
			byte[] ch = Packet.intToByteArray_Little(nchannel);
			byte[] port = Packet.intToByteArray_Little(nftpPort);
			byte[] mode = Packet.intToByteArray_Little(passiveMode);
			System.arraycopy(ch, 0, result, 0, 4);
			System.arraycopy(ftpServer.getBytes(), 0, result, 4,
					ftpServer.getBytes().length);
			System.arraycopy(port, 0, result, 72, 4);
			System.arraycopy(userName.getBytes(), 0, result, 76,
					userName.getBytes().length);
			System.arraycopy(password.getBytes(), 0, result, 96,
					password.getBytes().length);
			System.arraycopy(path.getBytes(), 0, result, 116,
					path.getBytes().length);
			System.arraycopy(mode, 0, result, 184, 4);
			return result;
		}
	}

	public static class SMsgAVIoctrlGetFtpResp {
		int channel; // Camera Index
		byte[] ftpServer = new byte[68]; // 10.1.1.1
		int ftpPort; // 21
		byte[] userName = new byte[20];
		byte[] password = new byte[20];
		byte[] path = new byte[68];
		int passiveMode;// 0 - off, 1 - on
		// total 188 bytes

	}

	public static class SMsgAVIoctrlSetFtpResp {
		int channel; // Camera Index
		int result; // 0: ok ; 1: failed
	}

	public static class SMsgAVIoctrlGetFtpReq {
		int channel; // Camera Index
		byte[] reserved = new byte[4];

		public static byte[] parseContent(int channel) {

			byte[] result = new byte[8];
			byte[] ch = Packet.intToByteArray_Little(channel);
			System.arraycopy(ch, 0, result, 0, 4);

			return result;
		}
	}

	// ///////////////////Mail Setting/////////////////////
	/*
	 * IOTYPE_USEREX_IPCAM_GET_SMTP_REQ 0x4005 IOTYPE_USEREX_IPCAM_GET_SMTP_RESP
	 * 0x4006 IOTYPE_USEREX_IPCAM_SET_SMTP_REQ 0x4007
	 * IOTYPE_USEREX_IPCAM_SET_SMTP_RESP 0x4008
	 */

	public static class SMsgAVIoctrlExGetSmtpReq {

		int channel; // Camera Index
		byte[] reserved = new byte[4];

		public static byte[] parseContent(int channel) {

			byte[] result = new byte[8];
			byte[] ch = Packet.intToByteArray_Little(channel);
			System.arraycopy(ch, 0, result, 0, 4);

			return result;
		}

	}

	public static class SMsgAVIoctrlExSetSmtpReq {
		int channel; // Camera Index
		byte[] sender = new byte[64]; /* �ʼ��ķ����� */
		byte[] receiver1 = new byte[64]; /* �ʼ��Ľ����� */
		byte[] server = new byte[64]; /* �ʼ���������ַ */
		int port; /* �ʼ�����˿� */
		int mail_tls; /* �Ƿ�ʹ�� tls ����Э��, 0������1��TLS��2��STARTLS */
		byte[] user = new byte[32]; /* �ʼ���������¼�û� */
		byte[] pwd = new byte[32]; /* �ʼ���������¼���� */

		public static byte[] parseContent(int channel, String sender,
				String receiver1, String server, int port, int mail_tls,
				String user, String pwd) {

			byte[] result = new byte[268];
			byte[] ch = Packet.intToByteArray_Little(channel);
			byte[] arrayport = Packet.intToByteArray_Little(port);
			byte[] arraymail_tls = Packet.intToByteArray_Little(mail_tls);

			System.arraycopy(ch, 0, result, 0, 4);
			System.arraycopy(sender.getBytes(), 0, result, 4,
					sender.getBytes().length);
			System.arraycopy(receiver1.getBytes(), 0, result, 68,
					receiver1.getBytes().length);
			System.arraycopy(server.getBytes(), 0, result, 132,
					server.getBytes().length);
			System.arraycopy(arrayport, 0, result, 196, 4);
			System.arraycopy(arraymail_tls, 0, result, 200, 4);
			System.arraycopy(user.getBytes(), 0, result, 204,
					user.getBytes().length);
			System.arraycopy(pwd.getBytes(), 0, result, 236,
					pwd.getBytes().length);

			return result;
		}

	}

	public static class SMsgAVIoctrlExGetSmtpResp {

		int channel; // Camera Index
		byte[] sender = new byte[64]; /* �ʼ��ķ����� */
		byte[] receiver1 = new byte[64]; /* �ʼ��Ľ����� */
		byte[] server = new byte[64]; /* �ʼ���������ַ */
		int port; /* �ʼ�����˿� */
		int mail_tls; /* �Ƿ�ʹ�� tls ����Э��, 0������1��TLS��2��STARTLS */
		byte[] user = new byte[32]; /* �ʼ���������¼�û� */
		byte[] pwd = new byte[32]; /* �ʼ���������¼���� */

	}

	public static class SMsgAVIoctrlExSetSmtpResp {
		int result; // 0: ok ; 1: failed
		byte[] reserved = new byte[4];
	}

}
